<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>customer_account</title>

  <!--  -->


  <link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link type="text/css" rel="stylesheet" charset="UTF-8"
    href="https://translate.googleapis.com/translate_static/css/translateelement.css">
  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet"
    href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome Icons -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <!-- IonIcons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
  <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
  <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>
<!--
`body` tag options:

  Apply one or more of the following classes to to the body tag
  to get the desired effect

  * sidebar-collapse
  * sidebar-mini
-->

<body class="hold-transition sidebar-mini">
  <div class="wrapper" id="app">
    <div class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                <div id="example1_wrapper" class="dataTables_wrapper dt-bootstrap4">
                  <div class="row">
                    <div class="col-sm-12">
                      <table id="example1" class="table table-bordered table-striped dataTable dtr-inline" role="grid"
                        aria-describedby="example1_info">
                        <thead>
                          <tr role="row">
                            <th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">操作
                            </th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="Browser: activate to sort column ascending">应收金额</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="Platform(s): activate to sort column ascending">可用金额</th>

                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="Platform(s): activate to sort column ascending">业务员</th>
                            <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                              aria-label="Platform(s): activate to sort column ascending">状态</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr role="row" class="odd" style="display: none;">
                            <td class="" tabindex="0"><i class="fas fa-cog"></i>&nbsp;&nbsp;|&nbsp;&nbsp;<i
                                class="fas fa-lock"></i><i class="fas fa-unlock"></i></td>
                            <td style="">Epiphany 2.20</td>
                            <td style="">Gnome</td>
                            <td style="">Epiphany 2.20</td>
                            <td style="">Epiphany 2.20</td>
                          </tr>
                          <tr v-for="(account,index) in accounts" role="row" class="odd">
                            <td><i class="fas fa-cog"></i>&nbsp;&nbsp;|&nbsp;&nbsp;
                              <a @click="updateEnd(account.caid)" style="" href="#"><i
                                  class="fas fa-lock"></i></a>|&nbsp;
                              <a @click="updateBegin(account.caid)" href="#"><i class="fas fa-unlock"></i></a>
                            </td>
                            <td><a href="#">{{account.amount_receivable}}</a></td>
                            <td>{{account.amount_available}}</td>
                            <td>{{account.salseman}}</td>
                            <td>
                              <div v-if="account.status == 0">
                                未激活
                              </div>
                              <div v-else>
                                激活
                              </div>
                            </td>
                          </tr>
                        </tbody>
                        <tfoot>
                        </tfoot>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- ./wrapper -->

  <!-- REQUIRED SCRIPTS -->

  <!-- jQuery -->
  <script src="plugins/jquery/jquery.min.js"></script>
  <!-- Bootstrap -->
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- AdminLTE -->
  <script src="dist/js/adminlte.js"></script>

  <!-- OPTIONAL SCRIPTS -->
  <script src="plugins/chart.js/Chart.min.js"></script>
  <!-- AdminLTE for demo purposes -->
  <script src="dist/js/demo.js"></script>
  <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  <script src="dist/js/pages/dashboard3.js"></script>
  <!--  -->

  <script src="plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
  <script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
  <script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
  <script src="dist/js/adminlte.min.js"></script>
  <script>
    new Vue({
      el: "#app",
      data: {
        accounts: [],

      },
      mounted() {
        axios
          .get('clientaccount/all')
          .then(res => {
            console.info(res.data);
            // for (var i = 0; i < res.data.data.length; i++) {

            //     if(res.data.data[i].status==0){

            //       res.data.data[i].status=="未激活"
            //     }else{
            //       res.data.data[i].status=="激活"
            //     }
            // }
            this.accounts = res.data.data;
            console.info(this.accounts);
          })
      },
      methods: {
        updateBegin: function (caid) {
          axios({
            url: 'clientaccount/updateBegin',
            method: 'get',
            params: {
              'caid': caid

            },
          }).then(res => {

          })
        },
        updateEnd: function (caid) {
          axios({
            url: 'clientaccount/updateEnd',
            method: 'get',
            params: {
              'caid': caid

            },
          }).then(res => {

          })
        }
      }
    });
  </script>
  <script>
    $(function () {
      $("#example1").DataTable({
        "responsive": true,
        "autoWidth": false,
      });
      $('#example2').DataTable({
        "paging": true,
        "lengthChange": false,
        "searching": false,
        "ordering": true,
        "info": true,
        "autoWidth": false,
        "responsive": true,
      });
    });
  </script>

</body>

</html>